#if 0
strcpy(d->name,"Domain0");
#endif
- /* Set up shared-info area. */
- update_dom_time(d);
- d->shared_info->domain_time = 0;
// prepare domain0 pagetable (maps METAphysical to physical)
// following is roughly mm_init() in linux/kernel/fork.c
+ return now;
+}
+
-+void update_dom_time(struct domain *d)
++void update_dom_time(struct exec_domain *ed)
+{
+// FIXME: implement this?
+ printf("update_dom_time: called, not implemented, skipping\n");
#endif /* __x86_64__ */
- /* Set up shared-info area. */
- update_dom_time(d);
- d->shared_info->domain_time = 0;
/* Mask all upcalls... */
for ( i = 0; i < MAX_VIRT_CPUS; i++ )
d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
* Copyright (C) 1991, 1992, 1995 Linus Torvalds
*/
+#include <xen/config.h>
#include <xen/errno.h>
+#include <xen/event.h>
#include <xen/sched.h>
#include <xen/lib.h>
#include <xen/config.h>
}
-void update_dom_time(struct domain *d)
+void update_dom_time(struct exec_domain *ed)
{
+ struct domain *d = ed->domain;
shared_info_t *si = d->shared_info;
unsigned long flags;
- read_lock_irqsave(&time_lock, flags);
+ if ( d->last_propagated_timestamp == full_tsc_irq )
+ return;
+ read_lock_irqsave(&time_lock, flags);
spin_lock(&d->time_lock);
+ d->last_propagated_timestamp = full_tsc_irq;
+
si->time_version1++;
wmb();
si->time_version2++;
spin_unlock(&d->time_lock);
-
read_unlock_irqrestore(&time_lock, flags);
+
+ send_guest_virq(ed, VIRQ_TIMER);
}
write_unlock_irq(&time_lock);
- update_dom_time(current->domain);
+ /* Others will pick up the change at the next tick. */
+ current->domain->last_propagated_timestamp = 0; /* force propagation */
+ update_dom_time(current);
}
if ( (rc = arch_final_setup_guest(p->exec_domain[0],c)) != 0 )
goto out;
- /* Set up the shared info structure. */
- update_dom_time(p);
-
set_bit(DF_CONSTRUCTED, &p->d_flags);
out:
goto out;
}
- /* Set up the shared info structure. */
- update_dom_time(d);
-
/* domain_unpause_by_systemcontroller */
if ( test_and_clear_bit(EDF_CTRLPAUSE, &ed->ed_flags) )
domain_wake(ed);
spin_unlock_irq(&schedule_data[cpu].schedule_lock);
- /* Ensure that the domain has an up-to-date time base. */
- if ( !is_idle_task(next->domain) )
- update_dom_time(next->domain);
-
if ( unlikely(prev == next) )
return;
*/
clear_bit(EDF_RUNNING, &prev->ed_flags);
- /* Mark a timer event for the newly-scheduled domain. */
+ /* Ensure that the domain has an up-to-date time base. */
if ( !is_idle_task(next->domain) )
- send_guest_virq(next, VIRQ_TIMER);
-
+ update_dom_time(next);
+
schedule_tail(next);
BUG();
TRACE_0D(TRC_SCHED_T_TIMER_FN);
if ( !is_idle_task(ed->domain) )
- {
- update_dom_time(ed->domain);
- send_guest_virq(ed, VIRQ_TIMER);
- }
+ update_dom_time(ed);
t_timer[ed->processor].expires = NOW() + MILLISECS(10);
add_ac_timer(&t_timer[ed->processor]);
struct exec_domain *ed = (struct exec_domain *)data;
TRACE_0D(TRC_SCHED_DOM_TIMER_FN);
- update_dom_time(ed->domain);
- send_guest_virq(ed, VIRQ_TIMER);
+ update_dom_time(ed);
}
/* Initialise the data structures. */
#define MILLISECS(_ms) (((s_time_t)(_ms)) * 1000000ULL )
#define MICROSECS(_us) (((s_time_t)(_us)) * 1000ULL )
-extern void update_dom_time(struct domain *d);
+extern void update_dom_time(struct exec_domain *ed);
extern void do_settime(unsigned long secs, unsigned long usecs,
u64 system_time_base);